package com.ruoyi.system.vo;

import com.ruoyi.common.annotation.Excel;
import lombok.Data;

import java.math.BigDecimal;
import java.text.DecimalFormat;

/**
 * @author xuyuankai
 * @version 1.0
 * @description
 * @date 2022-1-4 23:23
 */
@Data
public class ActStatVO {

    private Long id;

    private String gameName;

    private Long gameId;

    private Long schoolId;

    private Long facultyId;

    /**
     * 学校
     */
    @Excel(name="学校",sort = 1)
    private String school;

    /**
     * 参数院系
     */
    @Excel(name="参数院系",sort = 2)
    private String faculty;

    /**
     * 学校编号
     */
    @Excel(name="院校编号",sort = 3)
    private String deptCode;

    @Excel(name="A 平面",sort = 4)
    private Long aNum = 0L;
    @Excel(name="Ba 影视",sort = 5)
    private Long baNum = 0L;
    @Excel(name="Bb 微电影",sort = 6)
    private Long bbNum = 0L;
    @Excel(name="Bc 短视频",sort = 7)
    private Long bcNum = 0L;
    @Excel(name="C 动画",sort = 8)
    private Long cNum = 0L;
    @Excel(name="D 互动",sort = 9)
    private Long dNum = 0L;
    @Excel(name="E 广播",sort = 10)
    private Long eNum = 0L;
    @Excel(name="F 策划案",sort = 11)
    private Long fNum = 0L;
    @Excel(name="Ga 广告语",sort = 12)
    private Long gaNum = 0L;
    @Excel(name="Gb 长文案",sort = 13)
    private Long gbNum = 0L;
    @Excel(name="Gc 创意脚本",sort = 14)
    private Long gcNum = 0L;
    /**
     * 报送参评作品合计
     */
    @Excel(name="报送参评作品合计",sort = 15)
    private Long submitActNum = 0L;

    /**
     * 实际作品数
     */
    @Excel(name="参赛院校遴选前作品数量",sort = 16)
    private Long realActNum = 0L;

    /**
     * 参赛学生数
     */
    @Excel(name="参赛学生数",sort = 18)
    private Long studentNum = 0L;

    /**
     * 指导老师人数
     */
    @Excel(name="指导老师人数",sort = 19)
    private Long teacherNum = 0L;

    private Long statRealActNum;

    private Long statStudentNum;

    private Long statTeacherNum;

    /**
     * 报送比例
     */
    @Excel(name="报送比例",sort = 17)
    private String submitRate;

    public void setZero(){
        this.aNum = 0L;
        this.baNum = 0L;
        this.bbNum = 0L;
        this.bcNum = 0L;
        this.cNum = 0L;
        this.dNum = 0L;
        this.eNum = 0L;
        this.fNum = 0L;
        this.gaNum = 0L;
        this.gbNum = 0L;
        this.gcNum = 0L;
        this.submitActNum = 0L;
        this.realActNum = 0L;
//        this.studentNum = 0L;
//        this.teacherNum = 0L;
    }

    public void setValue(){
        this.realActNum = getRealActNum();
        this.submitRate = getSubmitRate();
        this.studentNum = getStudentNum();
        this.teacherNum = getTeacherNum();
    }

    public String getSubmitRate() {
        //double rate = new BigDecimal(getSubmitActNum()/getRealActNum()) //(double)(Math.round(getSubmitActNum()*10000/getRealActNum())/10000.0);
        //double rate = new BigDecimal((float)getSubmitActNum()/getRealActNum()).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
        DecimalFormat df = new DecimalFormat();
        df.setMaximumFractionDigits(2);
        df.setMinimumFractionDigits(2);
        if(getRealActNum() == null){
            return "-";
        }
        return df.format(getSubmitActNum() * 100.00 / getRealActNum()) + "%";
//        return rate*100 + "%";
//        return submitRate;
    }

    public void setSubmitRate(String submitRate) {
        this.submitRate = submitRate;
    }

    public Long getRealActNum() {
        if(this.statRealActNum != null && this.statRealActNum.intValue() >0){
            return this.statRealActNum;
        }
        return null;
    }

    public void setRealActNum(Long realActNum) {
        this.realActNum = realActNum;
    }

    public Long getStudentNum() {
//        if(this.statStudentNum != null && this.statStudentNum.intValue() >0){
//            return this.statStudentNum;
//        }
        return studentNum;
    }

    public void setStudentNum(Long studentNum) {
        this.studentNum = studentNum;
    }

    public Long getTeacherNum() {
//        if(this.statTeacherNum != null && this.statTeacherNum.intValue() >0){
//            return this.statTeacherNum;
//        }
        return teacherNum;
    }

    public void setTeacherNum(Long teacherNum) {
        this.teacherNum = teacherNum;
    }
}
